<%@ page language="java" contentType="text/html; charset=UTF-8"
  pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<%=request.getContextPath()%>/css/base.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/css/admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.validate.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.validate.methods.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/base.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/admin.js"></script>
</head>


<BODY class="input goods" sizcache="0" sizset="0" ><DIV class=bar>添加品牌 </DIV>
<div id="validateErrorContainer" class="validateErrorContainer">
		<div class="validateErrorTitle">以下信息填写有误,请重新填写</div>
		<ul></ul>
	</div>

<DIV class=body sizcache="0" sizset="0">

<FORM id=brandForm  method=post action=brandsave.do sizcache="0" sizset="0" >
<TABLE  id=infoTable class="inputTable" sizcache="0" sizset="0" >
<TBODY sizcache="0" sizset="0">
<TR>
<TH>品牌所在分类: </TH>
<INPUT  type=hidden name=id value=${brand.id} > 
<TD><SELECT name=goodsTypeId> 
<OPTION value="">请选择...</OPTION> 
<c:forEach items="${toptypes}" var="goodstype">
       <OPTION value=${goodstype.id} ${brand.goodsType.id==goodstype.id?'selected':''}>${goodstype.typeName}</OPTION> 
          <c:forEach items="${goodstype.underGoodTypes}" var="subgoodstype">
            <OPTION value=${subgoodstype.id} ${brand.goodsType.id==subgoodstype.id?'selected':''}>&nbsp;&nbsp;&nbsp;&nbsp;${subgoodstype.typeName}</OPTION> 
            <c:forEach items="${subgoodstype.underGoodTypes}" var="tgoodstype">
              <OPTION value=${tgoodstype.id} ${brand.goodsType.id==tgoodstype.id?'selected':''}>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${tgoodstype.typeName}</OPTION> 
            </c:forEach>
          </c:forEach>
      </c:forEach>
</SELECT> <LABEL class=requireField>*</LABEL> </TD></TR>
<TR>
<TH>品牌名称: </TH>
<TD><INPUT class=formText type=text name="brandName" id=brandName maxlength=30 value=${brand.brandName} > <LABEL class=requireField>*</LABEL> </TD></TR>
<TR class=specificationDisabledInfo>
<TH>排序: </TH>
<TD><INPUT class=formText title=只允许输入零或正整数 type=text name=sort maxlength=4 value=${brand.sort} > <LABEL class=requireField>*</LABEL> </TD></TR>
</TBODY></TABLE>
<DIV class=buttonArea><INPUT hideFocus class=formButton value="确  定" type=submit>&nbsp;&nbsp; <INPUT hideFocus class=formButton onclick="window.history.back(); return false;" value="返  回" type=button> </DIV>
<INPUT id=searchKey type=hidden name=searchKey value=${searchKey} > 
<INPUT id=type type=hidden name=type value=${type} > 
<INPUT id=pageSize type=hidden name=page.pageSize value=${page.pageSize} > 
<INPUT id=pageNumber type=hidden name=page.pageNumber value=${page.currentPage} > 
<INPUT id=totalSize type=hidden name=page.totalSize value=${page.totalRowsAmount} > 
<INPUT id=orderBy type=hidden name=pager.orderBy value=${page.orderBy} > 
<INPUT id=order  type=hidden name=pager.order value=${page.order}> 
</FORM>
</DIV>
<DIV style="DISPLAY: none" class=ke-reset>&nbsp;</DIV>
<DIV style="FILTER: alpha(opacity=50)" class=ke-mask></DIV></BODY>

<script type="text/javascript">


$().ready(function() {
    var $validateErrorContainer = $("#validateErrorContainer");
	var $validateErrorLabelContainer = $("#validateErrorContainer ul");
	var $brandForm = $("#brandForm");
    
	// 表单验证
	$brandForm.validate({	   
		errorClass: "validateError",   
		rules: {
			goodsTypeId: "required",
			brandName: "required",	
			sort: {required: true,digits: true}		
		},
		messages: {
			goodsTypeId: "请选择品牌类别!",
			brandName: "请填写品牌名称!",	
			sort:{required:"请填写商品排序!",digits:"请填写合法的数字!"}
		},
		submitHandler: function(form) {			   
			$(form).find(":submit").attr("disabled", true);
			form.submit();
		},
        errorPlacement: function(error, element) { 
            error.appendTo(element.parent()); 
        }
	});
			
})
</script>
</html>